package com.study.d2_iterator;

import java.util.ArrayList;
import java.util.Collection;
import java.util.function.Consumer;

public class Test3 {
    //掌握Collection集合的遍历方式3：lambda表达式
    public static void main(String[] args) {
        Collection<String> list = new ArrayList<>();
        list.add("java");
        list.add("c++");
        list.add("python");
        list.add("rust");
        list.add("go");
        list.add("php");
/*        list.forEach(new Consumer<String>() {
            @Override
            public void accept(String s) {
                System.out.println(s);
            }
        });*/
//        list.forEach(s-> System.out.println(s));
        list.forEach(System.out::println);
    }
}
